package com.zhang.learns.jpa.controller;

import com.zhang.learns.jpa.entity.Users;
import com.zhang.learns.jpa.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;

/**
 * @author zhanghaolian
 * @date 2021/12/27 14:26
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;

    @RequestMapping("/add")
    public Users addUser(Users user) {
        return userService.addUser(user);
    }

    @RequestMapping("findAll")
    public Iterable<Users> findAll() {
        return userService.findAll();
    }
}
